
function [value] = get_valueSETASperiod(data,depth,idx,pos);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% THIS FUNCTION RETURNS A SINGLE OBSERVATION  VALUE  AT THE SPECIFIED DATE
% WITHIN the SETAS PERIOD  (SEP 2010 - SEP 2012). 
% 
% 
% INPUT  : - data   : profiles of AWQ weekly data (depth x date)  
%                             for a single site 
%          - depth  : profile  sampling depth
%          - idx    : index of date of interest
%          - pos    : string, either 's' for surface or 'b' for
%                             bottom AWQ data
%
% OUTPUT : - value  : matrix of selected AWQ weekly data           
%
%
% Author: Benedicte Pasquer, IMOS/eMII (http://imos.org.au/)
% email: benedicte.pasquer@utas.edu.au
% May 2013   
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


if ~isempty(idx)
    
        switch pos
            case 's'
                 value = data(1,idx);
            
            case 'b' 
                [val,midx] = max(abs(depth(:,nt)));
                 value = data(midx,idx);                 
        end
    
else
    value = NaN;
   
end

   
